export default {
	data() {
		return {
			customPage: {
				//页面
				page: {
					paddingLeft: '',
					paddingRight: '',
					paddingTop: '',
					paddingBottom: '',
					'--page-bottom':'',
					'--page-left':'',
					'--page-top':'',
					'--page-right':'',
					'--menu-left':'',
				},
				//导航栏
				nav: {
					paddingTop: '',
					height: '',
					paddingLeft: '',
					paddingRight: '',
					paddingRight: '',
					'--menu-bar':''
				},
				navheight:0,
			}
		}
	},
	created() {
		let sys = uni.getSystemInfoSync();
		console.log('mixin')
		if (sys) {

			//导航栏高度 导航栏高度 = menu.statusBarHeight + menu.height + (menu.top - sys.statusBarHeight) * 2
			
			let navigationHeight;

			// #ifdef MP-WEIXIN
			let menu = uni.getMenuButtonBoundingClientRect();
			navigationHeight = sys.statusBarHeight + menu.height + (menu.top - sys.statusBarHeight) * 2;
			// #endif
			// #ifndef MP-WEIXIN
			navigationHeight = sys.statusBarHeight + 44;//非小程序端固定44
			// #endif
			console.log(sys.safeAreaInsets.top)
			//安全区域页面
			this.customPage.page.paddingTop = navigationHeight + 'px';
			this.customPage.page.paddingLeft = sys.safeAreaInsets.left + 'px';
			this.customPage.page.paddingRight = sys.safeAreaInsets.right + 'px';
			this.customPage.page.paddingBottom = sys.safeAreaInsets.bottom + 10 + 'px';
			this.customPage.page['--page-bottom'] = this.customPage.page.paddingBottom;
			this.customPage.page['--page-left'] = this.customPage.page.paddingLeft;
			this.customPage.page['--page-top'] = this.customPage.page.paddingTop;
			this.customPage.page['--page-right'] = this.customPage.page.paddingRight;
			this.customPage.page['--menu-left'] = menu.left+'px';
			//微信端导航条
			this.customPage.nav.paddingTop = sys.statusBarHeight + 'px';
			this.customPage.nav.height = navigationHeight + 'px';
			this.customPage.navheight = navigationHeight;
			this.customPage.nav.paddingLeft = 0 + 'px';
			this.customPage.nav.paddingRight = 0 + 'px';
			let right = sys.windowWidth - menu.left;
			this.customPage.nav['--menu-bar'] = right + 'px';
			
			//安卓上就默认 7 3 边距
			// #ifndef MP-WEIXIN 
			this.customPage.nav.paddingTop = sys.statusBarHeight + 7 + 'px';
			this.customPage.nav.paddingBottom = 7 + 'px';
			// this.customPage.nav.paddingLeft = 3 + 'px';
			// this.customPage.nav.paddingRight = 3 + 'px';
			// #endif





			console.log(this.customPage)

		}
	}
}


// // #ifdef MP-WEIXIN
//   navigationHeight = sys.safeAreaInsets.top + sys.statusBarHeight + menu.height + (menu.top - sys.statusBarHeight) * 2;
// // #endif
//    	// #ifndef MP-WEIXIN
//   navigationHeight = sys.safeAreaInsets.top + sys.statusBarHeight + 44 + 7 * 2;
// // #endif
// console.log(sys.safeAreaInsets)
// //安全区域页面
// this.customPage.page.paddingTop = navigationHeight + 'px';
// this.customPage.page.paddingLeft = sys.safeAreaInsets.left+ 'px';
// this.customPage.page.paddingRight = sys.safeAreaInsets.right+ 'px';
// this.customPage.page.paddingBottom = sys.safeAreaInsets.bottom+ 'px';
// //导航条
// this.customPage.nav.paddingTop = sys.safeAreaInsets.top + sys.statusBarHeight+ 'px';
// this.customPage.nav.height = navigationHeight+ 'px';
// this.customPage.nav.paddingLeft = 3+ 'px';
// this.customPage.nav.paddingRight = 3+ 'px';
// // #ifndef MP-WEIXIN
// this.customPage.nav.paddingTop = sys.safeAreaInsets.top + sys.statusBarHeight +7+ 'px';
// this.customPage.nav.paddingBottom = 7+ 'px';
// // #endif